/-app ...
TopLayout.ts
main.css
start.ts
/-docs
/-files
/-imports
/-persistence
Drive.ts
indexedDB.ts
mountDrive.ts
/-typings
errors.js
functions.ts
index.html
try.js
x
1
module teapo.app {
2
  
3
  export class TopLayout {
4
​
5
    private _drive: persistence.Drive = null;
6
    private _fileTree: teapo.files.FileTree = null;
7
    private _host: docs.DocHost = null;
8
    
9
    private _hostElement: HTMLElement = null;
10
    
11
    constructor() {
12
    }
13
  
14
    initWithMainContent(mainContent: HTMLElement) {
15
      this._hostElement = mainContent;
16
      if (this._hostElement && this._fileTree)
17
        this._hostAndTreeLoaded();
18
    }
19
    
20
    initWithFlyout(flyout: HTMLElement) {
21
      try {
22
        var fileTree = new teapo.files.FileTree(flyout);
23
​
24
        var uniqueKey = '5';
25
        var domTimestamp = 0;
26
​
27
        persistence.mountDrive(
28
          fileTree,
29
          uniqueKey,
30
          domTimestamp,
31
          <any>teapo.persistence,
32
          mountedDrive => { 
33
            this._fileTree = fileTree;
34
            this._drive = mountedDrive;
35
            if (this._hostElement && this._fileTree)
36
              this._hostAndTreeLoaded();
37
          });
38
      }
39
      catch (error) {
40
        alert(error + ' ' + error.stack);
41
        return;
42
      }
43
    }
44
  
45
    private _hostAndTreeLoaded() {
46
      alert('host and tree loaded '+this._drive.files().join(', '));
47
    }
48
  
49
  }
50
  
51
}
23:26